#include<stdio.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>



int main()
{
    int fd1 = open("log.txt",O_WRONLY | O_CREAT | O_TRUNC, 0666);
    int fd2 = open("log.txt",O_WRONLY | O_CREAT | O_APPEND, 0666);

    printf("%d\n",fd1);
    printf("%d\n",fd2);

    const char* message = "hello world\n";
    write(fd1,message,strlen(message));

    close(fd1);

    return 0;
}
